﻿import QtQuick 2.12
import QtQuick.Window 2.12

Window {
    visible: true
    title: "yan gsen"
    width: 640
    height: 480
    signal sendinfo()                  // qml 发送信号， c++ 接收
    signal receiveText(string str)    // c++ 发送信号， qml 接收
    Rectangle
    {
        objectName: "rect"
        anchors.fill: parent
        anchors.rightMargin: 0
        anchors.bottomMargin: 0
        anchors.leftMargin: 0
        anchors.topMargin: 0
        color: "red"
        MouseArea
        {
            anchors.fill: parent
            onClicked: sendinfo()

            Rectangle {
                id: rectangle
                x: 280
                y: 171
                width: 214
                height: 47
                color: "#a7c58f"
                radius: 10
            }

            // qml 发送信号 给c++
        }
    }
    onReceiveText:   // 当 c++ 发送信号， qml 接收
    {
        console.log("接受到 c++ 发送得我信号")
    }

}
